Ext.application({
    name: 'ZYY',
    appFolder: path+"/resource/admin",
    controllers: ['Viewport'],
    paths:{
        'Ext.ux': path+'/resource/admin/ux'
    },
    refs : [
    {
        ref: 'center', 
        selector: 'center'
    }
    ],
    launch: function() {
        Ext.defer(function() {
            Ext.create('Ext.container.Viewport', {
                layout: 'border',	
                items: [
                {
                    xtype: 'navhead',
                    region: 'north'
                },

                {
                    xtype: 'buttom',
                    region : 'south'
                },

                {
                    xtype: 'center',
                    region: 'center'
                },

                {
                    xtype: 'left', 
                    region : 'west'
                }
                ]
            });
            var hideMask = function () {
                Ext.get('loading').remove();
                Ext.fly('loading-mask').animate({
                    opacity:0,
                    remove:true
                });
            };
            Ext.defer(hideMask, 100);
        },200);
    },
    runAction:function(controllerName,actionName){
        var controller = this.getController(controllerName);
        controller.init(this);
        controller['action'+actionName]();
    },
    setMainView: function(view){
        console.log("加载视图：");
        console.log(view);
        //        var center = Ext.ComponentQuery.query('viewport')[0].layout.regions.center;
        var center=this.getCenter();
        if(center.items.indexOf(view)===-1){
            center.add(view);
        }
        center.setActiveTab(view);
    },
    removeNode : function(node) {
        if (!node)
            return;
        while (node.hasChildNodes()) {
            removeNode(node.firstChild);
            node.removeChild(node.firstChild);
        }
    }
})
